{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pymysql\n",
    "\n",
    "class Connectsql():\n",
    "    def __init__(self):\n",
    "        self.conn=pymysql.connect(host='127.0.0.1',user='root',password='1234',database='myschool',charset='gbk')\n",
    "    def getconn(self):\n",
    "        return self.conn\n",
    "    def getcursor(self):\n",
    "        return self.conn.cursor()\n",
    "    def getclose(self):\n",
    "        self.getconn().close()\n",
    "        self.getcursor().close()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
